package conf

import (
	"easyreport/model"
	"fmt"
	"gopkg.in/yaml.v2"
	"io/ioutil"
)

var Conf *model.Config

func NewConf() {
	bs, err := ioutil.ReadFile("application.yaml")
	if err != nil {
		panic("读取配置出错！")
	}

	Conf = new(model.Config)
	err = yaml.Unmarshal(bs, Conf)
	if err != nil {
		panic("加载配置出错！")
	}
	fmt.Println(Conf)
}

func Get() *model.Config {
	return Conf
}
